URL Encode and Decode Demo (VB.net) : URL Encode Decode « Server « ASP.Net






URL Encode and Decode Demo (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub SubmitHTMLEncode_Click(Sender As Object, E As EventArgs)
    Dim MySU as HTTPServerUtility
    MySU = Server
    lblMessage1.Text = "Encoded: " _
        & MySU.HTMLEnCode(txtHTMLEncode.Text) & "<BR>" _
        & "Enter HTML text to encode"
End Sub
Sub SubmitHTMLDecode_Click(Sender As Object, E As EventArgs)
    Dim MySU as HTTPServerUtility
    MySU = Server
    lblMessage2.Text = "Decoded: " _
        & MySU.HTMLDeCode(txtHTMLDecode.Text) & "<BR>" _
        & "Enter HTML text to decode"
End Sub
Sub SubmitURLEncode_Click(Sender As Object, E As EventArgs)
    Dim MySU as HTTPServerUtility
    MySU = Server
    lblMessage3.Text = "Encoded: " _
        & MySU.URLEnCode(txtURLEncode.Text) & "<BR>" _
        & "Enter URL text to encode"
End Sub
Sub SubmitURLDecode_Click(Sender As Object, E As EventArgs)
    Dim MySU as HTTPServerUtility
    MySU = Server
    lblMessage4.Text = "Decoded: " _
        & MySU.URLDeCode(txtURLDecode.Text) & "<BR>" _
        & "Enter URL text to decode"
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Encoding and DeCoding Sample Page</TITLE>
</HEAD>
<BODY TEXT="black" LINK="darkred" VLINK="darkred" ALINK="red" LEFTMARGIN="40" TOPMARGIN="40">
<form runat="server">
<Font Face="Tahoma">
<asp:Label
    id="lblMessage1"
    runat="server"
    Text="Enter HTML text to encode"
    Font-Bold="True"
/>
<asp:TextBox
    id="txtHTMLEncode"
    runat="server"
/>
<BR><BR>
<asp:button 
    id="butEncode"
    runat="server"
    text="Encode"
    Type="Submit"
    OnClick="SubmitHTMLEncode_Click" 
/>
<BR><BR>
<asp:Label
    id="lblMessage2"
    runat="server"
    Text="Enter HTML text to decode"
    Font-Bold="True"
/>
<asp:TextBox
    id="txtHTMLDecode"
    runat="server"
/>
<BR><BR>
<asp:button 
    id="butDecode"
    runat="server"
    text="Decode"
    Type="Submit"
    OnClick="SubmitHTMLDecode_Click" 
/>
<BR><BR>
<asp:Label
    id="lblMessage3"
    runat="server"
    Text="Enter URL text to encode"
    Font-Bold="True"
/>
<asp:TextBox
    id="txtURLEncode"
    runat="server"
/>
<BR><BR>
<asp:button 
    id="butEncode2"
    runat="server"
    text="Encode"
    Type="Submit"
    OnClick="SubmitURLEncode_Click" 
/>
<BR><BR>
<asp:Label
    id="lblMessage4"
    runat="server"
    Text="Enter URL text to decode"
    Font-Bold="True"
/>
<asp:TextBox
    id="txtURLDecode"
    runat="server"
/>
<BR><BR>
<asp:button 
    id="butDecode2"
    runat="server"
    text="Decode"
    Type="Submit"
    OnClick="SubmitURLDecode_Click" 
/>
</Font>
</Form>
</BODY>
</HTML>
           
       








Related examples in the same category

1.Decoding Encoded HTML Strings (VB.net)
2.Encoding URL Strings (VB.net)
3.Encoding URL Strings in VB.net
4.Encoding URL Strings in C#
5.Encoding HTML Strings (VB.net)
6.Server.HtmlEncode (VB.net)